feat: allow guardrail evaluation to carry attachment references - #1895
Open
apetraru-uipath wants to merge 1 commit into
Open
apetraru-uipath wants to merge 1 commit into
apetraru-uipath wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
One or more issues must be addressed before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Extends uipath-platform guardrail evaluation to send file attachment references to the backend.
Changes:
- Adds and exports
GuardrailAttachment. - Serializes attachments and applies an extended timeout.
- Adds tests and bumps the package version.
File summaries
| File | Description |
|---|---|
| packages/uipath-platform/tests/services/test_guardrails_service.py | Updated as part of this pull request. |
| packages/uipath-platform/src/uipath/platform/guardrails/guardrails.py | Updated as part of this pull request. |
| packages/uipath-platform/src/uipath/platform/guardrails/_guardrails_service.py | Updated as part of this pull request. |
| packages/uipath-platform/src/uipath/platform/guardrails/init.py | Updated as part of this pull request. |
| packages/uipath-platform/pyproject.toml | Updated as part of this pull request. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
apetraru-uipath
added a commit
that referenced
this pull request
Sep 14, 2026
@Traced records a function's arguments on the OpenTelemetry span by default, so every GuardrailAttachment.url — a short-lived SAS credential — was landing in input.value. Flagged by Copilot on #1895. An input_processor now replaces attachments[*].url with "<redacted>" and leaves everything else (payload, guardrail, attachment identity) intact; that is tighter than hide_input=True, which would drop the useful part of the span too. Also adds the two tests Copilot noted were missing: that an attachment-bearing evaluation forwards the 60s timeout, and that the default path does not. uipath-platform: 35 tests pass (+4); ruff, ruff format, mypy clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
apetraru-uipath
added a commit
that referenced
this pull request
Sep 16, 2026
@Traced records a function's arguments on the OpenTelemetry span by default, so every GuardrailAttachment.url — a short-lived SAS credential — was landing in input.value. Flagged by Copilot on #1895. An input_processor now replaces attachments[*].url with "<redacted>" and leaves everything else (payload, guardrail, attachment identity) intact; that is tighter than hide_input=True, which would drop the useful part of the span too. Also adds the two tests Copilot noted were missing: that an attachment-bearing evaluation forwards the 60s timeout, and that the default path does not. uipath-platform: 35 tests pass (+4); ruff, ruff format, mypy clean. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
apetraru-uipath
force-pushed
the
feat/guardrail-judge-file-support
branch
from
September 16, 2026 14:07
e831652 to
7145cf9
Compare
Adds an optional `attachments` keyword to GuardrailsService.evaluate_guardrail and a GuardrailAttachment model (id, fileName, mimeType, url), so a caller can tell the guardrails backend which files a guardrail should inspect instead of the backend seeing only attachment metadata embedded in the payload string. Also forwards a 60s timeout when attachments are present. The default client timeout is 30s and RequestSpec.timeout was constructed but never passed, so a validate call that waits on server-side file fetching would have timed out. An attachment url is a short-lived SAS credential, and @Traced records a function's arguments on the span by default, so an input_processor redacts attachments[*].url and leaves the rest of the span intact. Backward compatible: without `attachments` — or with an empty list — the request body is byte-identical to today, so an older backend is unaffected. The parameter is keyword-only and defaults to None, so existing callers are untouched. Bumps uipath-platform to 0.2.31. SDK_REFERENCE.md records the new parameter, which makes uipath a co-changed package, so it bumps to 2.14.21 and raises its floor to uipath-platform>=0.2.31. uipath-platform: 35 tests pass (+8); ruff, ruff format and mypy clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
apetraru-uipath
force-pushed
the
feat/guardrail-judge-file-support
branch
from
September 16, 2026 14:58
ba99f49 to
e475e89
Compare
|
🚨 Heads up:
|
apetraru-uipath
enabled auto-merge (squash)
September 16, 2026 15:28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
Adds an optional
attachmentskeyword toGuardrailsService.evaluate_guardrailand aGuardrailAttachmentmodel (id,fileName,mimeType,url), so a caller can tell the guardrails backend which files a guardrail should inspect — rather than the backend seeing only attachment metadata embedded in the payload string.Bumps
uipath-platformto 0.2.31 (0.2.30 on main at the time of writing).Review fixes
e831652c— SAS urls no longer reach the trace span.@tracedrecords a function's arguments on the OpenTelemetry span by default, so everyGuardrailAttachment.url(a short-lived SAS credential) was landing ininput.value. Aninput_processornow redactsattachments[*].urland leaves the rest of the span intact — tighter thanhide_input=True. Thanks Copilot.49b50329— lockfiles relocked after the version bump (uv lock --checkin CI).Notes for reviewers
attachments, or with an empty list, the request body is byte-identical to today.RequestSpec.timeoutwas constructed but never forwarded, so this passes 60 s explicitly when attachments are present.Test plan
packages/uipath-platform— 35 tests pass (+8 over baseline).ruff check,ruff format --check,mypy src testsclean.Pairs with UiPath/Agents#6256.
🤖 Generated with Claude Code